#include <stdio.h>

int SumArr(int array[], int n);

int main(void) {
    int a[5] = {1, 4, 5, 7, 9};

    //求数组a中前5个数的和
    printf("%d\n", SumArr(a, 5));
    return 0;
}

//求数组arrar中前n个数的和
int SumArr(int array[], int n) {
    int i, s = 0;

    for (i = 0; i < n; i++)
        s += array[i];

    return s;
}
